#include "../include/http_response.h"
#include <stdexcept>

namespace http {

HttpResponse::HttpResponse() : _redirectFlag(false), _statu(200) {}

HttpResponse::HttpResponse(int statu) : _redirectFlag(false), _statu(statu) {}

void HttpResponse::reSet() 
{
    _statu = 200;
    _redirectFlag = false;
    _body.clear();
    _redirectUrl.clear();
    _headers.clear();
}

void HttpResponse::setContent(const std::string &body, const std::string &type) 
{
    _body = body;
    setHeader("Content-Type", type);
}

void HttpResponse::setRedirect(const std::string &url, int statu) 
{
    _statu = statu;
    _redirectFlag = true;
    _redirectUrl = url;
}

} // namespace http